#!/bin/zsh

count_lines(){
  local dir="$1"
  local total_lines=0
  for file in $(find "$dir" -type f -name "*.go"); do
    file_lines=$(wc -l < "$file")
    echo "File: $file - $file_lines lines"
    total_lines=$((total_lines + file_lines))
  done
  echo "Total lines of code in .go files :$total_lines"
}

if [ -z "$1" ]; then
  echo "Usage:$0<directory>"
  exit 1
fi

count_lines "$1"
